package com.ruoyi.service.service.impl;

import com.ruoyi.service.domain.ServiceSupplies;
import com.ruoyi.service.mapper.ServiceSuppliesMapper;
import com.ruoyi.service.service.IServiceSuppliesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 耗材表Service业务层处理
 * 
 * @author ZDL
 * @date 2024-10-21
 */
@Service
public class ServiceSuppliesServiceImpl implements IServiceSuppliesService 
{
    @Autowired
    private ServiceSuppliesMapper serviceSuppliesMapper;

    /**
     * 查询耗材表
     * 
     * @param suppliesId 耗材表主键
     * @return 耗材表
     */
    @Override
    public ServiceSupplies selectServiceSuppliesBySuppliesId(Long suppliesId)
    {
        ServiceSupplies serviceSupplies = serviceSuppliesMapper.selectServiceSuppliesBySuppliesId(suppliesId);
        serviceSupplies.setSuppliesPrice(serviceSupplies.getSuppliesPrice() / 100);
        return serviceSupplies;
    }

    /**
     * 查询耗材表列表
     * 
     * @param serviceSupplies 耗材表
     * @return 耗材表
     */
    @Override
    public List<ServiceSupplies> selectServiceSuppliesList(ServiceSupplies serviceSupplies)
    {
        List<ServiceSupplies> serviceSuppliesList = serviceSuppliesMapper.selectServiceSuppliesList(serviceSupplies);
        for (ServiceSupplies serviceSupplies1 : serviceSuppliesList) {
            serviceSupplies1.setSuppliesPrice(serviceSupplies1.getSuppliesPrice() / 100);
        }
        return serviceSuppliesList;
    }

    /**
     * 新增耗材表
     * 
     * @param serviceSupplies 耗材表
     * @return 结果
     */
    @Override
    public int insertServiceSupplies(ServiceSupplies serviceSupplies)
    {
        return serviceSuppliesMapper.insertServiceSupplies(serviceSupplies);
    }

    /**
     * 修改耗材表
     * 
     * @param serviceSupplies 耗材表
     * @return 结果
     */
    @Override
    public int updateServiceSupplies(ServiceSupplies serviceSupplies)
    {
        return serviceSuppliesMapper.updateServiceSupplies(serviceSupplies);
    }

    /**
     * 批量删除耗材表
     * 
     * @param suppliesIds 需要删除的耗材表主键
     * @return 结果
     */
    @Override
    public int deleteServiceSuppliesBySuppliesIds(Long[] suppliesIds)
    {
        return serviceSuppliesMapper.deleteServiceSuppliesBySuppliesIds(suppliesIds);
    }

    /**
     * 删除耗材表信息
     * 
     * @param suppliesId 耗材表主键
     * @return 结果
     */
    @Override
    public int deleteServiceSuppliesBySuppliesId(Long suppliesId)
    {
        return serviceSuppliesMapper.deleteServiceSuppliesBySuppliesId(suppliesId);
    }
}
